package edu.sctu.practice.class01.wulixia.month09_wlx.assign03.one;

/**
 * Created by wulixia on 2015/10/22.
 * 抽象类几何类的子类 梯形
 */
class Rectangle extends GeometricObject {
    double overLength;
    double lowerLength;
    double height;

    public Rectangle(String color, double overLength, double lowerLength, double height) {
        super(color);
        this.overLength = overLength;
        this.lowerLength = lowerLength;
        this.height = height;
    }

    @Override
    //梯形面积
    public double findArea() {
        double rectangle_Area;

        rectangle_Area = (overLength + lowerLength) * height / 2;
        return rectangle_Area;
    }

    @Override
    //梯形周长
    public double findPerimeter() {
        double rectangle_Perimeter;

        rectangle_Perimeter = overLength + lowerLength +
                2 * ( Math.sqrt(Math.pow((lowerLength - overLength)/2,2) + Math.pow(height,2)));
        return rectangle_Perimeter;

    }
}
